package com.example.idachuappone.utils;

import android.content.Context;
import android.widget.Toast;

public class MainToast {
    private static Toast toast;

    public static void show(Context ctx, String msg, int type) {
        if (toast != null) {
            toast.setText(msg);
            if (type == 0) {
                toast.setDuration(0);
            } else {
                toast.setDuration(1);
            }
        } else if (type == 0) {
            toast = Toast.makeText(ctx, msg, 0);
        } else {
            toast = Toast.makeText(ctx, msg, 1);
        }
        toast.show();
    }
}
